<template>
  <a-modal
    :title="title"
    width="60%"
    :visible="visible"
    :footer="null"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
      <a-textarea placeholder="请输入拒绝理由" v-model="response" :autosize="{ minRows: 5, maxRows: 20 }" />
    <a-divider style="margin-bottom: 32px"/>
    <div class="examples" >
    <a-button style="margin-left:30px;" size="large"  @click="refuseCashInfo()"  :disabled="successButton" type="primary">确定</a-button>
    <a-button style="margin-left:40px;" size="large" type="danger" @click="closeTab()">关闭</a-button>
    </div>
  </a-modal>
</template>

<script>
  import { getAction,postAction } from '@/api/manage'

export default {
  name: 'templateDetails',
  components: {
  },
  data() {
    return {
      response:"",
      infoId:undefined,
      successButton: false,
      visible: false,
      title: '拒绝页面',
      confirmLoading: false,
    }
  },
  activated(){
    this.successButton=false
  },
  created() {},
  methods: {
    //拒绝
    refuseCashInfo(){
      this.visible = true
      let obj = {cashInfoLogId:this.infoId,response:this.response};
      this.$nextTick(function () {
        postAction("/cash/refuse",obj)
          .then(res => {
            if (res.success) {
              this.successButton=true
              this.$router.back()
              this.$notification.success({
                message: '审核结果',
                description: `提现 : `+"拒绝通过",
              });
            }
          }).catch(err => {
        });
      })
    },
    show(records) {
      this.visible = true;
      this.infoId = records;
    },
    closeTab() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.closeTab()
    },
    handleCancel() {
      this.closeTab()
    }
  }
}
</script>

<style lang="less" scoped>
  .examples {
    text-align: center;
  }
</style>
